import {RvaUtils} from '@/api/rva/util'

export default {
  props: ['prop', 'value', 'formRef', 'formData', 'formItemProp', 'requestParams'],
  data() {
    return {
      showComponent: true,
      rules:[],
      disabled: false,
      dictData: [],
    };
  },
  created() {
    RvaUtils.parseValidateRules(this.prop, this.rules);
    if (['radio', 'checkbox', 'select'].indexOf(this.prop.type) >= 0) {
      RvaUtils.getDicts(this.prop.dictType, this);
    }
    this.originalType = this.prop.type;
    this.afterCreated();
  },
  methods: {
    setValue(val) {
      this.$emit('input', val);
    },
    disable() {
      this.disabled = true;
    },
    enable() {
      this.disabled = false;
    },
    show () {
      this.showComponent = true;
    },
    hide() {
      this.showComponent = false;
    },
    afterCreated() {}
  },
  watch: {
  }
}
